package bishi.yuxin;

import java.util.Scanner;

public class demo3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int l = in.nextInt();
        while(l >0) {
            int n = 3;
            int[] tab = new int[7];
            for(int i = 0;i < n;i++) {
                tab[in.nextInt()]++;
            }

            int sum = 0;
            if(tab[6] == 3) {
                sum += 2000;
            }
            if(tab[6] == 2) {
                sum += 1000;
            }
            if(tab[6] == 1){
                sum += 500;
            }
            if(tab[6] == 0) {
                sum += 100;
            }
            System.out.println(sum);
            l--;
        }
    }
}
